package com.punai.apply.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.punai.apply.domain.ApplyCostMouldDetails;
import com.punai.apply.mapper.ApplyCostMouldDetailsMapper;
import com.punai.apply.service.IApplyCostMouldDetailsService;
import com.punai.standard.domain.StaVersion;
import com.punai.standard.mapper.StaVersionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 成本编制模板管理详情Service业务层处理
 *
 * @author zhx
 * @date 2023-03-21
 */
@Service
public class ApplyCostMouldDetailsServiceImpl extends ServiceImpl<ApplyCostMouldDetailsMapper,ApplyCostMouldDetails> implements IApplyCostMouldDetailsService
{
    @Autowired
    private ApplyCostMouldDetailsMapper applyCostMouldDetailsMapper;
    @Autowired
    private StaVersionMapper staVersionMapper;

    /**
     * 查询成本编制模板管理详情
     *
     * @param id 成本编制模板管理详情主键
     * @return 成本编制模板管理详情
     */
    @Override
    public ApplyCostMouldDetails selectApplyCostMouldDetailsById(String id)
    {
        return applyCostMouldDetailsMapper.selectApplyCostMouldDetailsById(id);
    }

    /**
     * 查询成本编制模板管理详情列表
     *
     * @param applyCostMouldDetails 成本编制模板管理详情
     * @return 成本编制模板管理详情
     */
    @Override
    public List<ApplyCostMouldDetails> selectApplyCostMouldDetailsList(ApplyCostMouldDetails applyCostMouldDetails)
    {
        return applyCostMouldDetailsMapper.selectApplyCostMouldDetailsList(applyCostMouldDetails);
    }

    /**
     * 新增成本编制模板管理详情
     *
     * @param applyCostMouldDetails 成本编制模板管理详情
     * @return 结果
     */
    @Override
    public int insertApplyCostMouldDetails(ApplyCostMouldDetails applyCostMouldDetails)
    {
            return applyCostMouldDetailsMapper.insert(applyCostMouldDetails);
    }

    /**
     * 修改成本编制模板管理详情
     *
     * @param applyCostMouldDetails 成本编制模板管理详情
     * @return 结果
     */
    @Override
    public int updateApplyCostMouldDetails(ApplyCostMouldDetails applyCostMouldDetails)
    {
        return applyCostMouldDetailsMapper.updateById(applyCostMouldDetails);
    }

    /**
     * 批量删除成本编制模板管理详情
     *
     * @param ids 需要删除的成本编制模板管理详情主键
     * @return 结果
     */
    @Override
    public int deleteApplyCostMouldDetailsByIds(String[] ids)
    {
        return applyCostMouldDetailsMapper.deleteApplyCostMouldDetailsByIds(ids);
    }

    /**
     * 删除成本编制模板管理详情信息
     *
     * @param id 成本编制模板管理详情主键
     * @return 结果
     */
    @Override
    public int deleteApplyCostMouldDetailsById(String id)
    {
        return applyCostMouldDetailsMapper.deleteApplyCostMouldDetailsById(id);
    }

    @Override
    public List<StaVersion> listVersion(String mouldId, Long companyId) {
        return staVersionMapper.selectListByMouldId(companyId,mouldId);
    }
}
